package com.ssy.lingxi.after.sale.model.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 退货退款内部状态
 * @author 伍将
 * @date 2020/9/24
 * @version 2.0.0
 */
public enum ReturnGoodsRefundInnerStatusEnum {

    /**
     * 所有
     */
    ALL(0, "所有"),
    /**
     * 未退款
     */
    TO_BE_REFUND(1, "未退款"),
    /**
     * 退款失败
     */
    REFUND_FAIL(2, "退款失败"),
    /**
     * 退款成功
     */
    REFUND_SUCCEED(3, "退款成功"),
    /**
     * 无需退款
     */
    UN_NEED_REFUND(4, "无需退款");

    private final Integer code;
    private final String message;

    ReturnGoodsRefundInnerStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getDeclaringClass(), this.getCode());
    }


    public static String getMessage(Integer code) {
        return Arrays.stream(ReturnGoodsRefundInnerStatusEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(ALL).getMessage();
    }
}
